﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ConferenceArranger.ConferenceComponent;
using ConferenceArranger.Strategy;

namespace ConferenceArranger
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {   
            //step 1, read input from text file, create talk list
            string fileName = textBox1.Text;
            TalkProcessor talkProcessor = new TalkProcessor();
			
            try
            {
                talkProcessor.InitTalkList(fileName);
            }catch(Exception ex){
                textBox1.Text += ex.Message;
            }
            List<Talk> talkList = talkProcessor.GetOutput();

            //step 2, create session list
            SessionProcessor sessionProcessor = new SessionProcessor(talkList);
            try
            {
                sessionProcessor.ArrangeSessions();
            }
            catch (Exception ex)
            {
                textBox1.Text += ex.Message;
            }
            List<Session> sessionList = sessionProcessor.GetOutput();

            //step 3, 
            TrackProcessor trackProcessor = new TrackProcessor(sessionList);
            List<Track> trackList = trackProcessor.GetOutput();

            Conference conference = new Conference(trackList);
            conference.WriteOutput(textBox2.Text);
            button1.Text = "Done arranging conference!";
            
            
        }

       
    }
}
